package com.sanq.product.cab.tools.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * version: 日志操作
 * ---------------------
 *
 * @author sanq.Yan
 * @date 2020/1/26
 */
public class LogUtil {

    private static Logger logger = null;

    private static volatile LogUtil instance = null;

    private LogUtil() {
    }

    private LogUtil(Class clazz) {
    }

    public static LogUtil getInstance(Class clazz) {
        if (instance == null) {
            synchronized (LogUtil.class) {
                if (instance == null) {
                    instance = new LogUtil(clazz);
                    logger = LoggerFactory.getLogger(clazz);
                }
            }
        }
        return instance;
    }

    public void d(String msg) {
        logger.debug(msg);
    }

    public void i(String msg) {
        logger.info(msg);
    }

    public void w(String msg) {
        logger.warn(msg);
    }

    public void e(String msg) {
        logger.error(msg);
    }

    public void d(String format, Object... obj) {
        logger.debug(format, obj);
    }

    public void i(String format, Object... obj) {
        logger.info(format, obj);
    }

    public void w(String format, Object... obj) {
        logger.warn(format, obj);
    }

    public void e(String format, Object... obj) {
        logger.error(format, obj);
    }
}
